package io.openmessaging.storage.dledger.protocol;

import java.util.concurrent.CompletableFuture;

/**
 * Both the RaftLogServer(inbound) and RaftRpcService (outbound) should implement this protocol
 * DLedger 服务端协议 extend  客户端 端协议，主要定义如下4个方法
 */
public interface DLedgerProtocol extends DLedgerClientProtocol {

    //发起投票请求
    CompletableFuture<VoteResponse> vote(VoteRequest request) throws Exception;

    //Leader节点向从节点发送心跳包
    CompletableFuture<HeartBeatResponse> heartBeat(HeartBeatRequest request) throws Exception;

    //拉取日志条目
    CompletableFuture<PullEntriesResponse> pull(PullEntriesRequest request) throws Exception;

    //推送日志条目，用于日志传播
    CompletableFuture<PushEntryResponse> push(PushEntryRequest request) throws Exception;

}
